<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> - 登录</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="../css/bootstrap.min-lumen.css" rel="stylesheet">
    <link href="../css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="../css/animate.css" rel="stylesheet">
    <link href="../css/style.css?v=4.1.0" rel="stylesheet">
    <link href="../css/plugins/progressbar/mprogress.css" rel="stylesheet"/>
    <link href="../css/plugins/progressbar/style.css" rel="stylesheet"/>
    <!--[if lt IE 9]>
<meta http-equiv="refresh" content="0;ie.html" />
<![endif]-->
    <script>if (window.top !== window.self) {
        window.top.location = window.location;
    }</script>
</head>
<body class="gray-bg">
<div class="middle-box text-center loginscreen  animated fadeInDown" id="loginModel">
    <div>
        <div>
            <!-- <h1 class="logo-name">h</h1> -->
        </div>
        <h3>欢迎使用</h3>
        <div class="form-group">
            <input type="text" class="form-control" placeholder="用户名" required="" v-model="userName"/>
        </div>
        <div class="form-group">
            <input type="password" class="form-control" placeholder="密码" required="" v-model="password"/>
        </div>
        <div class="form-group">
            <input type="checkbox" value="remember-me" id="rememberMe" v-model="rememberMe"/>
            记住我
        </div>
        <button class="btn btn-primary block full-width m-b" @click="login()">登 录</button>
        <!-- <p class="text-muted text-center"> <a href="login.html#"><small>忘记密码了？</small></a> | <a href="register.html">注册一个新账号</a>
        </p> -->
    </div>
</div>
<!-- 全局js -->
<script src="../js/config/config.js"></script>
<script src="../js/jquery.min.js?v=2.1.4"></script>
<script src="../js/bootstrap.min.js?v=3.3.6"></script>
<script src="../js/vue/vue.min.js"></script>
<script src="../js/util/ajaxFactory.js"></script>
<script src="../js/plugins/layer/layer.min.js"></script>
<script src="../js/plugins/progressbar/mprogress.js"></script>
<script src="../js/plugins/progressbar/init-mprogress.js"></script>
<script src="../js/encrypt/md5.js"></script>
<script>

    var user = localStorage.getItem("user");
    var username = '';
    var password = '';
    if (user != null && user != undefined) {
        try {
            user = JSON.parse(user);
            username = user.username;
            password = user.password;
        } catch (err) {
        }
    }

    var loginVue = new Vue({
        el: "#loginModel",
        data: {
            userName: username,
            password: password,
            rememberMe: ''
        },
        methods: {
            login: function () {
                var that = this;
                $z.ajaxPost({
                    url: basePath + "/login/doLogin",
                    data: {
                        userName: that.userName,
                        password: that.password
                    },
                    success: function (data) {
                        $z.dealCommonResult(data, function () {
                            //如果点了记住我，则存储到本地
                            if (that.rememberMe) {
                                localStorage.setItem("user", JSON.stringify({
                                    username: that.userName,
                                    password: that.password
                                }));
                            }
                            window.location.href = "home.html";
                        });
                    }
                });
            }
        }
    });
</script>

</body>

</html>


